package Chapter6.one_to_one;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class Author implements Serializable {
	private static final long serialVersionUID = 1L;
	private long id;
	private AuthorAddress address;
	private String addresss;
	private String name;

	public Author() {
	}

	public Author(AuthorAddress address) {
		this.address = address;
	}

	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Embedded
	@AttributeOverrides({
			@AttributeOverride(name = "address", column = @Column(name = "ADDR")),
			@AttributeOverride(name = "name", column = @Column(name = "NAMES")) })
	public AuthorAddress getAddress() {
		return address;
	}

	public void setAddress(AuthorAddress address) {
		this.address = address;
	}

	public String getAddresss() {
		return addresss;
	}

	public void setAddresss(String addresss) {
		this.addresss = addresss;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
